// TOWN DIALOGUE SCRIPT
//    Town 40: Portal Fortress

begintalkscript;

variables;

short i,j,k,r1,choice;

	
begintalknode;
	tag = 10;
	state = -1;
	nextstate = -1;
	condition = 1;
	text1 = "The Portal Fortress is well-guarded. The Avernite warriors stationed here have been exposed to the magical energies coming from the portal nonstop for months. This has left their brains gooey and slow to react.";
	text2 = "The guard says, while barely looking at you, _Commander is in the northeast labs. Portal in the southwest._";
	text3 = "The recent disasters, however, have forced the guards to full alertness. They all stand stiffly at attention as you pass.";
	code =
		rs(2); rs(3);
		if (gf(308,5) == 0) 
			as(2);
			else as(3);
	break;

// Kelner

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Kelner";
	text1 = "You meet a solemn and attentive mage in elegant clothes. Traces of gray are starting to appear in his hair. He walks up and formally greets you, surrounded by an aura of authority.";
	text2 = "_Welcome back, adventurer. I am Kelner, chief administrator of the Portal Fortress. Can I help you?_";
	text5 = "Kelner nods to you. _I am busy, but I can make time for you. You are very important. Any other way I can help the surface explorer?_";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What do you do here?_";
	text1 = "He waves at his surroundings. _As I said, I am the chief administrator. I coordinate all comings and goings for the Portal Fortress. It's sort of a promotion from my Tower of Magi post._";

begintalknode;
	state = 1;
	nextstate = 5;
	question = "_What is a chief administrator?_";
	text1 = "_A fancy way of saying that I run the place, but all the pests in the military still get to boss me around._";

begintalknode;
	state = 5;
	nextstate = -1;
	question = "_So would you consider me a pest?_";
	text1 = "_Sorry, I meant no disrespect. Plus, officially, you are not a part of the military. You are part of Unspecified Services, a much subtler and less intrusive organization._";

begintalknode;
	state = 2;
	nextstate = 6;
	question = "_Why do they call this the Portal Fortress?_";
	text1 = "_Because this fort houses the passage through which Avernites come to the surface, and through which we can sometimes return. As you probably guessed, since you originally came up from the Tower of Magi to here._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Why did you leave the Tower of Magi?_";
	text1 = "_I spent most of my magical career there, first in training and then as administrator. I finally got transferred up here, much to my relief._";
	text3 = "He shakes his head. _I don't want to discuss the tower anymore. I wanted to leave there, and I am relieved that I was able to get myself away from there before the evil finally came to the surface. However, I will always mourn the many friends I lost._";
	action = DEP_ON_SDF 308 5 0;

begintalknode;
	state = 3;
	nextstate = 4;
	condition = gf(308,5) == 0;
	question = "_Why were you so eager to leave?_";
	text1 = "_Once, years ago, a mage named Linda performed certain very dark experiments. I trained there at the time, and was able to help some adventurers purge the evil she brought._";
	text2 = "_Later, when I was administrator there, Linda returned and I sensed that old habits were starting to return. So I pulled strings and came here. It was not a situation I wanted to deal with anymore._";

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_What sort of experiments was Linda involved in?_";
	text1 = "_You see Linda, formerly of the Triad, was a master wizard. She brought a demon into the tower once, and only with great effort was it repelled. Never trusted her, never will._";

begintalknode;
	state = 6;
	nextstate = 7;
	question = "_Do you like your job?_";
	text1 = "_It's a tough job running this place, with so many people coming up and so many supplies coming up to keep track of and some people wanting to return to the underworld as well. But it beats being in the Tower._";
	text3 = "_Well, now that the Tower is gone, there's an interruption in the transit, but it has not eased my labors. I have to work day and night figuring out how to restore the connection to Avernum. We're cut off, and that's bad. Damnably difficult job._";
	action = DEP_ON_SDF 308 5 0;

begintalknode;
	state = 7;
	nextstate = -1;
	question = "_So I can return to Avernum if I want to?_";
	text1 = "_Yes, sometimes people can return. You should speak with Seles. She's by the portal. She coordinates all of that._";
	text3 = "He frowns. _Nobody is returning to Avernum until the Tower is restored and the portal becomes operational again. And nobody is coming up either. And more supplies? Forget it._";
	action = DEP_ON_SDF 308 5 0;

begintalknode;
	state = 1;
	nextstate = 8;
	question = "_Are you looking to hire an adventurer?_";
	text1 = "He laughs. _That takes me back. I remember, a few years ago, some adventurers asked me that, and I had them wipe out some serpent cult. But now? Even if I had something you could do, I wouldn't ask you._";
	text2 = "_You are the surface explorers. Your time is too valuable to be spent running my errands._";

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_What happened to those adventurers?_";
	text1 = "_Their courage eventually gained them a fair amount of fame and wealth. They are still down in Avernum, still fighting our enemies. I can rest easier being up here, knowing they're down there, looking after things._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(40,11) == 1;
	question = "_I found a strange scroll in the library. It's all gibberish._";
	text1 = "He looks it over. Then he shrugs. _Tell me about it. A lot of the works here don't make any sense. We mostly keep them around for the paper. I can't help you._";

begintalknode;
	state = 1;
	nextstate = 9;
	condition = gf(40,7) >= 1;
	question = "_There's a strange platform in a room nearby. What is it?_";
	text1 = "_It's very interesting. We're doing research to figure out how to easily place enchantments on items. Fascinating stuff. Vahnatai magic, but what isn't?_";
	text2 = "_You place something you wield or wear, like armor or a blade, into the box in the middle of the circle. Then you pull the lever, and your item will be filled with energy. Feel free to use it. You're important enough. But choose carefully ... the machine is only charged up enough for one use._";

begintalknode;
	state = 9;
	nextstate = -1;
	question = "_Any advice on how to use it?_";
	text1 = "_Only put one item into the box at a time. If you try to bless more than one item at once, the results can be unpredictable._";
	text2 = "_Also, only put something in there if you're sure you want it blessed. The device will make a sword more dangerous. Its effect on, say, a shovel can be less satisfying._";
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(40,12) >= 1;
	question = "_I used the platform. Is it possible for you to recharge it for me?_";
	code =
		run_hardcode(4);
	break;

// Walner

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Walner";
	text1 = "You meet a short, portly man with blonde hair, just visible under his cowl. His fingers are stained with ink, and a variety of pens protrude from his pockets.";
	text2 = "He holds a pen in his hand now, ringed with an unusual rainbow design. He looks up at you as you approach. _Greetings! I am Walner, a sage and part-time alchemist._";
	text5 = "Walner says, _Anything else, explorer? I am here to assist you any way I can._";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_What is your job here in the fort?_";
	text1 = "_I am a sage! As soon as I heard about the surface portal, I came here to see what the fuss is about. Sages are always welcome wherever they go. People of learning and magic are needed up here more than anything._";
	text2 = "_Soon I will emerge and study the surface. While I wait, I study in the library._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_What's the use of sitting around and learning?_";
	text1 = "_Knowledge is its own sort of power. Learning to deal with the new things we'll encounter and magic to defend ourselves from them. Soon, I will be out on the surface, helping us to relearn what we need to survive up there._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Are many Avernites interested in coming up here?_";
	text1 = "_As you can guess, almost everyone below wants to come up here. The chance to see the surface again is making people frantic. However, only so many can be brought up at a time._";
	text2 = "He grins. _Of course, when getting a berth, it helps to have certain skills._";

begintalknode;
	state = 30;
	nextstate = 32;
	question = "_What kinds of skills does a sage have?_";
	text1 = "_Well, I try to know a little about everything. Also, I am an alchemist of some skill._";

begintalknode;
	state = 32;
	nextstate = -1;
	question = "_Are you teaching any alchemy right now?_";
	text1 = "_I am not teaching, but I can put my skills in your service. For example, I can make brews which can heal the imbiber, or make him strong, or even double his speed!_";

begintalknode;
	state = 30;
	nextstate = 34;
	question = "_Tell me about the library?_";
	text1 = "_This library was set up as sort of a briefing area for mages arriving up here, to sort of summarize what we know and what we've found. Clearly, not much so far. Be sure to look at the books. Some of them are sure to be interesting._";
	text2 = "_The main challenge down here, of course, is finding more books._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_What does the rainbow design on your pen mean?_";
	text1 = "He holds up the rainbow pen. _Oh, this? Call it a symbol of pride._";

begintalknode;
	state = 34;
	nextstate = -1;
	question = "_You need more books?_";
	text1 = "_Always. If you are out on the surface and find any magical research which seems interesting, I'll give you a very fair price for it._";
	action = SET_SDF 40 14 1;
	code =
		toggle_quest(18,1);
	break;
	
begintalknode;
	state = 34;
	nextstate = -1;
	condition = gf(40,11) == 1;
	question = "_That reminds me, I found an odd scroll in the library. It didn't make any sense._";
	text1 = "_Oh, that one. It's written in code. Some letters need to be substituted for other letters. I remember it. Here's how it works..._ (He explains how to read the scroll.)";
	action = SET_SDF 40 11 2;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(40,14) >= 1 && party_has_item(212) > 0;
	question = "_I found some notes of a magical nature for you._ (Sell them.)";
	code =
		run_hardcode(3);
	break;
	
begintalknode;
	state = 29;
	nextstate = 35;
	question = "_Can you make a potion for me?_";
	text1 = "_It is one of my specialties. If you have foraged any lichen or moss or fungi with the proper properties, you can show them to me. If they are fresh enough, I can make something for you._";
	text2 = "_For example, if you brought me healing herbs in adequate quantities, I could make you healing or curing potions._";
	text3 =  "_Even better, with the right mix of herbs, I could make a brew to speed you up in combat or restore your magical energy. Very useful. Much in demand._";
	
begintalknode;
	state = 35;
	condition = num_of_item(289) >= 2;
	question = "_I would like a healing potion._ (Give 2 sprigs of healing herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Walner hands you a clay jug filled with a bitter, medicinal brew.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,2);
		reward_give(220);
		play_sound(22);
	break;
	
begintalknode;
	state = 35;
	condition = num_of_item(289) >= 1;
	question = "_I would like a curing potion._ (Give 1 sprig of healing herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Walner hands you a clay jug filled with a bitter, medicinal brew.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,1);
		reward_give(221);
		play_sound(22);
	break;

begintalknode;
	state = 35;
	condition = num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like a speed potion._ (Give 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Walner hands you a clay jug filled with a green, minty-smelling brew.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(222);
		play_sound(22);
	break;

begintalknode;
	state = 35;
	condition = num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like an energy potion._ (Give 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Walner hands you a clay jug filled with a thick brew with little bits of brown stuff suspended in it.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(223);
		play_sound(22);
	break;
	
begintalknode;
	state = 35;
	condition = 1;
	question = "_I don't need any potions._";
	text1 = "_All right. Safe travels to you._";
	action = END_TALK;

begintalknode;
	state = 29;
	condition = 1;
	question = "_I don't need anything else._";
	text1 = "_Then good luck on the surface, explorer. We all envy you._";
	action = END_TALK;

// Jake

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Jake";
	text1 = "You meet an archer of Avernum, polishing a fine cavewood bow with practiced fingers. His armor bears captain's insignia, and his face bears the expression of one who'd rather be anywhere else.";
	text2 = "He nods brusquely. _Captain Jake._";
	text5 = "The captain continues to polish his bow. _Yes? Anything else I can help you with?_";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = -1;
	question = "_Ready for battle?_";
	text1 = "_I'll need to be. When the Empire finds where Fort Emergence is hidden, and they will, we'll all have to fight._";

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_Are you passing through or stationed here?_";
	text1 = "He seems irritated at the interruption. _I'm going to Fort Emergence._";

begintalknode;
	state = 58;
	nextstate = 59;
	question = "_Fort Emergence isn't far. Why are you going there?_";
	text1 = "_There to serve again under old, dear Commander Johnson._";

begintalknode;
	state = 59;
	nextstate = 60;
	question = "_What do you think of Commander Johnson?_";
	text1 = "He looks to make sure nobody is listening. _Well, I can tell you, because you're Unspecified Services and won't count for spit in the end. I've served under that vile old bastard before, in Fort Duvno._";
	text2 = "_He's vicious and cruel, from his hair to his toes._";

begintalknode;
	state = 60;
	nextstate = -1;
	condition = gf(21,11) > 0;
	question = "_I've been working for Captain Johnson._";
	text1 = "_Going out to hunt and kill, no doubt. It's his only way._";

begintalknode;
	state = 60;
	nextstate = -1;
	condition = gf(21,11) == 0;
	question = "_I haven't worked for Captain Johnson._";
	text1 = "_Well, if you want to be rewarded for bloodshed, he's the man to talk to._";

begintalknode;
	state = 60;
	nextstate = -1;
	question = "_Where is Fort Duvno?_";
	text1 = "_Little town in Avernum. What does it matter?_";

begintalknode;
	state = 60;
	nextstate = -1;
	question = "_What do you have against our department?_";
	text1 = "_Mark my words. They can make all the pretty words they want about our meeting the Empire and talking to them and coexisting on the surface, or whatever. But Johnson is in charge at the fort, and the fort is where all the big decisions will be made._";
	text2 = "_Remember that. This'll all end in blood. Lots of it._ With that, he turns away.";
	action = END_TALK;

// Carol

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 85;
	question = "Carol";
	text1 = "You meet a very tall, dignified woman. Her face and short, dark hair are starting to bear the signs of middle age. She is grinding up some herbs and roots.";
	text2 = "She stands to greet you. _I am Carol, a healer of the Hamer clan. Do you require my assistance?_";
	text5 = "Carol smiles and works on preparing a fresh, aromatic poultice. She waits to see if you have anything else to say.";
	action = INTRO;

begintalknode;
	state = 85;
	nextstate = 86;
	question = "_How do you serve this fort?_";
	text1 = "She indicates the herbs and poultices that surround her. _I am a healer, brought near the surface to exert my skills._";

begintalknode;
	state = 86;
	nextstate = 87;
	question = "_Are you glad to be here?_";
	text1 = "_My husband and I were brought up to serve here. The work is hard, but satisfying. I am only a little disappointed._";

begintalknode;
	state = 85;
	nextstate = 88;
	question = "_Is there much call for your healing skills?_";
	text1 = "_Not yet. I was brought here to heal the soldiers who may be hurt in upcoming battles. We all hope such battles may be averted, of course, but, well, it's best to be prepared._";

begintalknode;
	state = 87;
	nextstate = -1;
	question = "_Who is your husband?_";
	text1 = "_My husband Tor looks after the supplies._ She smiles. _It's what he does best._";

begintalknode;
	state = 87;
	nextstate = -1;
	question = "_Why are you disappointed?_";
	text1 = "She sighs. _I did so want to see the surface and not be cooped up in yet another cave. Oh well. I believe, if I'm patient, I may yet emerge above ground._";

begintalknode;
	state = 88;
	nextstate = 89;
	question = "_How would you suggest I prepare?_";
	text1 = "_A fair question. If you would like, I can teach you some first aid skills. If only more warriors would take time to learn a few basic principles, many lives would be saved. Are you interested?_";

begintalknode;
	state = 89;
	nextstate = -1;
	question = "_Yes, that would be useful._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("First Aid Training","For a small fee to make up for the loss of time, Carol can give you invaluable training in first aid.",4,3,3);
	break;

begintalknode;
	state = 89;
	nextstate = 85;
	question = "_No, thank you._";
	text1 = "_Fair enough. But when you get smacked and aren't sure how to set a broken bone, don't blame me!_";
	action = END_TALK;
	
// Seles

begintalknode;
	tag = 120;
	state = -1;
	nextstate = 113;
	question = "Seles";
	text1 = "A neatly dressed mage stands between you and the intense loop of energy that is the surface portal. She holds a thick notebook. The energy of the portal makes her hair stand almost straight up.";
	text2 = "_Welcome back, adventurer. I am Seles, overseer of the portal. Please be careful, and don't use the portal without my direction._";
	text5 = "Seles watches you, seeming oblivious to the powerful torrents of energy crackling around her. _Do you have some business with the portal?_";
	action = INTRO;

begintalknode;
	state = 113;
	nextstate = 114;
	question = "_What are you responsible for?_";
	text1 = "_My title is Portal Overseer. I look after the portal, watch out for power surges, and direct those arriving from Avernum. Also when someone wants to use the portal, it is I they must give their request to, and I who give permission._";

begintalknode;
	state = 114;
	nextstate = 115;
	question = "_Is your job difficult?_";
	text1 = "_It's a tricky job. So many want to use the portal, for so many reasons._";

begintalknode;
	state = 115;
	nextstate = 116;
	question = "_What exactly is so tricky?_";
	text1 = "_The portal takes a lot of energy and can only send so many people and supply crates in a day. Most of its energy goes to bringing up as many people as possible. Access for other purposes, most of which are generally deemed frivolous, is limited._";
	text2 = "_That is why anyone who wishes to use the portal must request permission from me._";

begintalknode;
	state = 116;
	nextstate = -1;
	question = "_What would you consider a frivolous request?_";
	text1 = "_Visiting friends and family, retrieving something you forgot, that sort of thing. Portal energy is just too limited to spend on non-vital things._";

begintalknode;
	state = 113;
	nextstate = 119;
	question = "_What are all of these supplies?_";
	text1 = "_Food, weaponry, and so forth, all sent up from Avernum. We can't send out raiders onto the surface to look for goods, for fear of the Empire detecting us. Alas, we must bring most of our equipment up from below._";

begintalknode;
	state = 119;
	nextstate = -1;
	question = "_Even the terrible food and ale?_";
	text1 = "Seles sighs. _Even the terrible food and ale._";

begintalknode;
	state = 113;
	nextstate = -1;
	question = "_Can I use the portal?_";
	code =
		run_hardcode(108);
	break;

begintalknode;
	state = 113;
	nextstate = 117;
	condition = gf(308,6) >= 1 && gf(308,6) <= 2;
	question = "_Do you know anything about what happened to the Orb of Thralni?_";
	text1 = "_I don't know who stole it or why, but I do know where they went. You see, any teleportation up here affects the portal, and I can cast spells to tell who blipped where and why and adjust this portal to compensate. Thus, I can help you find the thieves._";

begintalknode;
	state = 117;
	nextstate = 118;
	condition = gf(308,6) >= 1;
	question = "_Where did the thieves go?_";
	text1 = "_I detected a teleportation out of Fort Emergence, and I was able to magically tell where the thieves went to. If you use the portal now, you will end up near where the thieves are. You'll have to find your own way back, however._";

begintalknode;
	state = 118;
	nextstate = -1;
	question = "_Any advice on how to do that?_";
	text1 = "_Not really. You're the adventurer. Though maybe you might start by hijacking their portal._";

// Seles

begintalknode;
	tag = 140;
	state = -1;
	nextstate = 141;
	question = "Seles";
	text1 = "Seles the mage still stands in front of the portal. However, the portal flickers ominously and sparks occasionally fly out of it. She no longer looks unconcerned about its proximity.";
	text5 = "Seles nods to you nervously, casting a worried glance at the portal behind her. ";
	action = INTRO;

begintalknode;
	state = 141;
	nextstate = 142;
	question = "_What is it you do, again?_";
	text1 = "_I am still the Portal Overseer, a much more difficult job since the Tower disaster._";

begintalknode;
	state = 142;
	nextstate = 143;
	question = "_Why is it a harder job now?_";
	text1 = "_It's a horrible job now. It's taking all my energy to keep what's going on in the Tower of Magi now from destroying the portal. Someone can teleport down there now, but they won't be able to for long. Gods help us if nobody can do anything._";
	text3 = "_A grim job, since the Tower disaster. Nobody will be going down or coming up for a while. You can still request permission to use the portal, but I don't think there's much I'll be able to do for you._";
	action = DEP_ON_SDF 308 5 2;

begintalknode;
	state = 141;
	nextstate = -1;
	question = "_We would like to use the teleporter._";
	code =
		run_hardcode(108);
	break;

begintalknode;
	state = 141;
	nextstate = -1;
	question = "_What is wrong with the portal?_";
	text1 = "_Tower of Magi disaster. We need to get someone down there, and fast, to take the Tower back from the evil creatures and stabilize the portal. Otherwise, the portal will be destroyed, along, probably, with most of Avernum._";
	text3 = "_The Tower disaster cut the portal loose at the Avernum end, and it'll take a lot of work to anchor it again. Nobody is going down and coming up for a while. I hope you can make peace with the Empire, or we will have to fight a war with no reinforcements.";
	action = DEP_ON_SDF 308 5 2;


begintalknode;
	state = 141;
	nextstate = 144;
	condition = gf(308,6) >= 1 && gf(308,6) <= 2;
	question = "_Do you know anything about what happened to the Orb of Thralni?_";
	text1 = "_I don't know who stole it or why, but I do know where they went. You see, any teleportation up here affects the portal, and I can cast spells to tell who blipped where and why and adjust this portal to compensate. Thus, I can help you find the thieves._";

begintalknode;
	state = 144;
	nextstate = 146;
	condition = gf(308,6) >= 1;
	question = "_Where did the thieves go?_";
	text1 = "_I detected a teleportation out of Fort Emergence, and I was able to magically tell where the thieves went to. If you use the portal now, you will end up near where the thieves are. You'll have to find your own way back, however._";

begintalknode;
	state = 146;
	nextstate = -1;
	question = "_Any advice on how to do that?_";
	text1 = "_Not really. You're the adventurer. Though maybe you might start by hijacking their portal._";

begintalknode;
	state = 141;
	nextstate = 145;
	condition = gf(308,5) >= 3;
	question = "_I saved the Tower of Magi._";
	text1 = "_And a good thing you did, too. I suspect everyone in Avernum would have been doomed, had you failed. And it is a good thing we were able to rescue you._";

begintalknode;
	state = 145;
	nextstate = -1;
	question = "_You rescued me?_";
	text1 = "_Of course. We couldn't let you die without at least trying to help you, could we? The portal here was already set to pull people up from the Tower of Magi. Some quick adjustments enabled us to scoop you up._";

// Tor

begintalknode;
	tag = 160;
	state = -1;
	nextstate = 169;
	question = "Tor";
	text1 = "You meet an aging, worn-down veteran of Avernum. He patrols ceaselessly through the fort, appraising the supplies, soldiers, walls, and everything else with a long practiced eye.";
	text2 = "He extends a callused hand to you. _Call me Tor._";
	text5 = "Tor scratches his back wearily. _You still need to talk to me?_";
	action = INTRO;

begintalknode;
	state = 169;
	nextstate = 170;
	question = "_Why are you wandering around?_";
	text1 = "_I have to keep an eye on every weapon and bit of provender which passes through here. Supplies are my life._";

begintalknode;
	state = 170;
	nextstate = 171;
	question = "_I see. So you are in charge of managing all the supplies?_";
	text1 = "He grins proudly. _Yep. Farmed for a while, but looking after goods is something I've always had a knack for._";

begintalknode;
	state = 170;
	nextstate = 172;
	question = "_No offense, but that sounds a bit boring._";
	text1 = "_I suppose, to the uninformed. Anyway, supplies are half of my life. Carol's the other half._";

begintalknode;
	state = 172;
	nextstate = -1;
	question = "_Who's Carol?_";
	text1 = "_My wife. She's a healer, and a fine one at that. She's up here with me. If she wasn't, well, I wouldn't be here neither._";

begintalknode;
	state = 171;
	nextstate = -1;
	question = "_What was farming like?_";
	text1 = "_Tough work. Disease. Salamanders. Nephilim. More salamanders. Just for a few mushrooms. Major pain. Sold the farm to the field hands and left it at that._";

begintalknode;
	state = 171;
	nextstate = 173;
	question = "_So this is your calling, then?_";
	text1 = "_Well, not sure about quartermaster being a calling. You're too young to remember, but once I gave supplies to every single person who entered Avernum. They teleported down, and I gave 'em a knife and some food to get 'em by until they found work._";
	text2 = "_It was good work. And this is good work too. Really appropriate, I mean._";

begintalknode;
	state = 173;
	nextstate = -1;
	question = "_I don't get it. Appropriate in what way?_";
	text1 = "_Well, once I gave supplies to everyone who came down from the surface. Now I take care of the goods for everyone comin' up! Symmetry, you know?_";
	
begintalknode;
	state = 169;
	nextstate = -1;
	question = "_I'd like to do some shopping._";
	text1 = "_I'd love to help, but none of it is mine to sell. I just send it all where the army tells me to. You're better off going to the towns to the north to get supplies of your own._";

// Julio

begintalknode;
	tag = 180;
	state = -1;
	nextstate = 197;
	question = "Julio";
	text1 = "You meet a small, heavily muscled man with dark skin and a quick eye. He wears dark clothes, a black hood, and a wicked sword. He bows sharply. _I gladly greet you, explorer. I am Julio, traveler._";
	text5 = "_I remain at your service, surface explorer. How else may I assist you?_";
	action = INTRO;

begintalknode;
	state = 197;
	nextstate = 198;
	question = "_Your job is what, exactly?_";
	text1 = "_I'm an explorer. I make maps, that sort of thing._";

begintalknode;
	state = 198;
	nextstate = 199;
	question = "_Where have you explored?_";
	text1 = "_I traveled from one end of Avernum to the other, looking for a route to the surface. I swore an oath, you see._";

begintalknode;
	state = 198;
	nextstate = 200;
	question = "_What kinds of maps have you made?_";
	text1 = "_You probably have one of my maps. I'm the one who mapped out these caves up here. I also made the only map we have of the area above. We haven't even been up there, but we have a map._";
	text2 = "_Bet you're wondering how we did that!_";

begintalknode;
	state = 200;
	nextstate = 201;
	question = "_How can you map a region you've never seen?_";
	text1 = "_Magic! A mage managed to give me a split-second magical view of the land above Fort Emergence, from way, way up. From that, I made the map! Pretty amazing, huh?_";

begintalknode;
	state = 201;
	nextstate = -1;
	question = "_It is a remarkable feat._";
	text1 = "_Yes, indeed! I drew a whole map, from a tiny glance. Excellent work, if I do say so myself._";

begintalknode;
	state = 199;
	nextstate = 202;
	question = "_What was your oath?_";
	text1 = "_A sacred one! I promised I'd never rest until I saw the light of day again, good honest sunlight. And it looks like I'll finally get the chance, even if I have to sneak out through Fort Emergence to do it!_";

begintalknode;
	state = 202;
	nextstate = -1;
	question = "_Why are you thinking of sneaking out?_";
	text1 = "_They aren't letting anyone out until they know it's safe, they say. Well, hell with that! I've been in prison down there for long enough. If I die, fine. I can deal with that._";
	text2 = "_But damn it, I'll die in the sun!_";

begintalknode;
	state = 200;
	nextstate = -1;
	question = "_Can I get one of these remarkable maps?_";
	text1 = "He looks suspicious. _You're Unspecified Services, right? Any maps you're authorized to get, you can get from Anaximander. Back in Fort Emergence. I wouldn't know what information I'm allowed to give you._";

// Denise

begintalknode;
	tag = 200;
	state = -1;
	nextstate = 225;
	question = "Denise";
	text1 = "A young female mage sits at her cavewood desk, reading a scroll. She looks irritated by your intrusion. _I'm Denise. Leave me alone._";
	text5 = "Denise is irritated. _What else do you want?_";
	action = INTRO;

begintalknode;
	state = 225;
	nextstate = 226;
	question = "_Sorry to intrude. What do you do here?_";
	text1 = "_Look, what do I have to say or do to get some studying time alone? As if I didn't already have enough problems._";

begintalknode;
	state = 226;
	nextstate = 228;
	question = "_What are you studying?_";
	text1 = "_What's it to you? You don't think everyone gains magical abilities by killing monsters, do you?_";

begintalknode;
	state = 226;
	nextstate = 227;
	condition = gf(40,8) <= 1;
	question = "_Perhaps I can help._";
	text1 = "She slams her book shut in anger. However, this time, she doesn't seem angry at you. _I left an amulet down in the Tower of Magi, a valuable focusing aid! They rushed me along to come up here, and I forgot it!_";
	text2 = "_Now, that bureaucrat Seles won't let me retrieve it, and I can't go on to my post without it!_";
	action = SET_SDF 40 8 1;
	code =
		toggle_quest(17,1);
	break;
	
begintalknode;
	state = 227;
	nextstate = -1;
	question = "_I take it you don't like this Seles person._";
	text1 = "_I hope she gets an infection. A special sort of infection._ She gives an unnerving smile.";

begintalknode;
	state = 228;
	nextstate = -1;
	question = "_I just asked an innocent question. You don't have to insult me._";
	text1 = "_Some of us don't want to go around butchering poor creatures all the time. We get our skill through good, honest work. So buzz off!_";
	action = END_TALK;

begintalknode;
	state = 225;
	nextstate = -1;
	condition = has_spec_item(31) > 0 && gf(40,8) == 1;
	question = "_I've retrieved your amulet._ (Give it to her.)";
	code =
		run_hardcode(109);
	break;

begintalknode;
	state = 227;
	nextstate = -1;
	question = "_What post are you heading for?_";
	text1 = "_Look, I'm Unspecified Services, like you. I can't talk about it. Come to think of it, I probably shouldn't talk to you!_";
	action = END_TALK;

begintalknode;
	state = 227;
	nextstate = -1;
	condition = gf(40,8) <= 1;
	question = "_I'm bound to go to the Tower of Magi sooner or later. I'll find your amulet._";
	text1 = "She perks up. _Can you really get to the Tower? If you can bring me back my amulet from the Tower of Magi, I'll make it worth your while!_";
	action = SET_SDF 40 8 1;
	
begintalknode;
	state = 225;
	nextstate = -1;
	condition = gf(40,8) > 1;
	question = "_I got your amulet back. Can't you be more polite to me?_";
	text1 = "_Hmmm. No. I don't think I can._";

	
// technician

begintalknode;
	tag = 240;
	state = -1;
	nextstate = -1;
	question = "technician";
	text1 = "You meet the technician in charge of operating the portal. It's an incredibly difficult and stressful job, and it has taken its toll. The moment he see you, he says, _What're you doing up here? No adventurers up here! Get away! You'll destroy everything! You'll kill us all!_";
	action = END_TALK;

// apprentice

begintalknode;
	tag = 260;
	state = -1;
	nextstate = -1;
	question = "apprentice";
	text1 = "You try to engage the scribe in conversation, but he is hard at work. He points to the wizard in the corner. _That's Kelner. You should talk to him._";

